/*
 * File Find is the intial portion that asks for the input of listings.txt, 
 * and then puts the info into map/set for the other two (propertyParse, and agentAnalyze)
 */

import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
import java.util.TreeMap;
import java.util.Comparator;
import java.util.TreeSet;
/**
 *
 * @author Paul Pfaff (paul42@my.wgu.edu)
 */

public class fileFind {
    public TreeMap <Integer, property>  agents;
    public TreeSet properties;
    Comparator<property> comp = new comparator();

public void init() throws FileNotFoundException{
      Scanner console = new Scanner(System.in);
      System.out.print("Input file: ");
      String inputFileName = console.next();
      File inputFile = new File(inputFileName);
      Scanner input = new Scanner(new File("listings.txt"));     
      
        agents = new TreeMap<Integer, property>(); //specially made treemap that has an INT as the key
        properties = new TreeSet(new comparator()); //generic treemap that calls the comparator
        
        while(input.hasNextLine())//<editor-fold> 
          {
          int propertyNumber = input.nextInt();    
          String propertyType = input.next();
          double propertyValue = input.nextDouble();    
          int agentID = input.nextInt();
          input.nextLine();
          property propertyNew = new property(propertyNumber, propertyType.toUpperCase(), propertyValue, agentID);   
          agents.put(agentID, propertyNew);
          properties.add(propertyNew);
      } //</editor-fold> //reads input, makes objects, sticks them into maps
      input.close();
      System.out.println("Reached end of fileFind");
} // Starts up and finds the file to input, makes objects and sticks them into maps.
}
